import { http } from '@/api/http'
import { ModuleTypeEnum, RequestHttpEnum } from '@/enums/httpEnum'
import { LoginResult } from '@/api/path/system.d'
import { httpErrorHandle } from '@/utils/http'

export const loginApi = async (data: object) => {
  try {
    const res = await http(RequestHttpEnum.POST)<LoginResult>(`${ModuleTypeEnum.SYSTEM}/login`, data)
    return res
  } catch (error) {
    httpErrorHandle()
  }
}
